package com.xm.zcf.myInterceptor;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.xm.zcf.domain.user.User;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2017/3/13.
 */
@Component
@Scope("prototype")
public class AdminInterceptor extends MethodFilterInterceptor{
    @Override
    protected String doIntercept(ActionInvocation actionInvocation) throws Exception {
        User existUser= (User) ActionContext.getContext().getSession().get("user");
        if(existUser!=null){
            return actionInvocation.invoke();
        }
        return "noLogin";
    }
}
